<?php get_header() ?>

	<div id="container">
		<div id="content">

			<div id="now-reading-library" class="now-reading">
				<h2><?php _e('My Books','dkret'); ?></h2>
<?php if( can_now_reading_admin() ) : ?>
				<p><?php _e('Admin','dkret'); ?>: &raquo; <a href="<?php manage_library_url() ?>"><?php _e('Manage Books','dkret'); ?></a></p>
<?php endif; ?>

<?php if( have_books('status=reading&num=-1') ) : ?>
				<h3><?php _e('Current','dkret'); ?> (<?php echo total_books('reading', 0) ?>):</h3>

<?php while( have_books('status=reading&num=-1') ) : the_book(); ?>
				<div class="now-reading-reading book">
					<a href="<?php book_permalink() ?>" title="<?php book_author() ?>: <?php book_title() ?>"><img width="100" height="170" class="alignleft" src="<?php book_image() ?>" alt="<?php book_title() ?>" /></a>
					<a href="<?php book_permalink() ?>"><?php book_title() ?></a> <br /><p><?php _e('by','dkret'); ?> <a href="<?php book_author_permalink() ?>"><?php book_author() ?></a></p>
				</div>
<?php endwhile; ?>
<?php endif; ?>

<?php if( have_books('status=unread&num=-1') ) : ?>
				<h3><?php _e('Planned Books','dkret'); ?> (<?php echo total_books('unread', 0) ?>):</h3>
<?php while( have_books('status=unread&num=-1') ) : the_book(); ?>
				<div class="now-reading-unread book">
					<a href="<?php book_permalink() ?>" title="<?php book_author() ?>: <?php book_title() ?>"><img width="100" height="170" class="alignleft" src="<?php book_image() ?>" alt="<?php book_title() ?>" /></a>
					<a href="<?php book_permalink() ?>"><?php book_title() ?></a> <br /><p><?php _e('by','dkret'); ?> <a href="<?php book_author_permalink() ?>"><?php book_author() ?></a></p>
				</div>
<?php endwhile; ?>
<?php endif; ?>

<?php if( have_books('status=read&orderby=finished&order=desc&num=8') ) : ?>
				<h3><?php _e('Recent Books','dkret'); ?> (<?php echo total_books('read', 0) ?>):</h3>

				<div class="now-reading-read book">
<?php while( have_books('status=read&orderby=finished&order=desc&num=-1') ) : the_book(); ?>
					<a href="<?php book_permalink() ?>" title="<?php book_author() ?>: <?php book_title() ?>"><img class="alignleft" src="<?php book_image() ?>" alt="<?php book_title() ?>" width="100" height="170" /></a>
<?php endwhile; ?>
				</div>

				<div class="now-reading-read book">
<?php $count = 0; while( have_books('status=read&orderby=finished&order=desc&num=-1') ) : the_book(); ?>
<?php $count++; if ($count < 9) {} else { ?>
					<ul>
						<li><a href="<?php book_permalink() ?>" title="<?php book_author() ?>: <?php book_title() ?>"><?php book_title() ?></a> (<?php book_author() ?>)</li>
					</ul>
<?php } ?>
<?php endwhile; ?>
				</div>

<?php endif; ?>

				<div id="now-reading-statistic" class="infoblock">
<?php if ((total_books('', 0)) == 1) { ?>
					<span class="books-read-total"><?php printf(__('%s book read overall.', 'dkret'), total_books('', 0)) ?></span>
<?php } else { ?>
					<span class="books-read-total"><?php printf(__('%s books read overall.', 'dkret'), total_books('', 0)) ?></span>
<?php } if ((books_read_since('1 year', 0)) == 1) { ?>
					<span class="books-read-year"><?php printf(__('%s book read in the last year.','dkret'), books_read_since('1 year', 0)) ?></span>
<?php } else { ?>
					<span class="books-read-year"><?php printf(__('%s books read in the last year.','dkret'), books_read_since('1 year', 0)) ?></span>
<?php } if ((books_read_since('1 month', 0)) == 1) { ?>
					<span class="books-read-month"><?php printf(__('%s book read in the last month.','dkret'), books_read_since('1 month', 0)) ?></span>
<?php } else { ?>
					<span class="books-read-month"><?php printf(__('%s books read in the last month.','dkret'), books_read_since('1 month', 0)) ?></span>
<?php } ?>
				</div><!-- #now-reading-statistic .infoblock -->

<?php do_action('nr_footer'); ?>

			</div><!-- #now-reading-library -->
		
		</div><!-- #content -->
	</div><!-- container -->

<?php get_sidebar() ?>
<?php get_footer() ?>